package board;

import java.util.List;

import com.opensymphony.xwork2.Action;

public class ListAction implements Action {

	private List<BoardData> boardList;
	private Search search;
	
	@Override
	public String execute() throws Exception {
		
		BoardDao boardDao = BoardDao.getInstance();
		
		if( search == null ){
			boardList = boardDao.getBoardList();
		} else {
			boardList = boardDao.searchBoard(search);
		}
		
		System.out.println(boardList.size());
		
		return SUCCESS;
	}

	
	//getter, setter;
	public List<BoardData> getBoardList() {
		return boardList;
	}
	
	public Search getSearch() {
		return search;
	}


	public void setSearch(Search search) {
		this.search = search;
	}


	public void setBoardList(List<BoardData> boardList) {
		this.boardList = boardList;
	}

}
